package com.google.code.maven2.plugins.hotswap.support;

import java.io.File;
import java.io.FileFilter;

/**
 * To use, call <code>DirectoryFileFilter.DIRECTORY</code>
 *
 * @author Mike Nereson
 * @since 1.0
 */
public class DirectoryFileFilter
        implements FileFilter
{
    /**
     * Singleton instance of directory filter.
     *
     * @since Commons IO 1.3
     */
    public static final FileFilter DIRECTORY = new DirectoryFileFilter();

    /**
     * Singleton instance of directory filter. Please use the identical DirectoryFileFilter.DIRECTORY constant. The new name is more JDK 1.5 friendly as it doesn't clash with other
     * values when using static imports.
     */
    public static final FileFilter INSTANCE = DIRECTORY;

    /**
     * Restrictive consructor.
     */
    protected DirectoryFileFilter()
    {
    }

    /**
     * Tests whether or not the specified abstract pathname should be included in a pathname list.
     *
     * @param pathname The abstract pathname to be tested
     * @return <code>true</code> if the file is determined to be a directory file
     */
    public boolean accept(File file)
    {
        return file.isDirectory();
    }
}